﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using DotNETX.Authentication.Db;

namespace DotNETX.Authentication.Web.Demo
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            System.Data.IDbConnection con = DotNETX.Authentication.Db.Access.ConnectionUtils.CreateAccessConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};", System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App_Data\\db.accdb")));
            DotNETX.Web.Handlers.LoginHandler.Authenticater = new Authentication.Authenticater()
            {
                //UserManger = DbUserManager.CreateOracleUM("icareicap", "icareicap", "123", "sm_user", "usercode", "password", "user_joint")
                //UserManager = DotNETX.Authentication.Db.SqlServerUserManager.Create(".\\SQLEXPRESS", "icareworkingmeal", "sa", "sa", "ath_user", "u_loginid", "u_pwd", "u_id")

                UserManager = DotNETX.Authentication.Db.AccessUserManager.Create(con, "busers", "buid", "bpwd", "buid"),
                TokenManager = DotNETX.Authentication.Db.AccessTokenManager.Create(con, "tokens", "btoken", "buid", "bltime", "blvtime")
            };

        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}